<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.springside.modules.security.springsecurity.SpringSecurityUtils" %>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Favicons --> 
<link rel="shortcut icon" type="image/png" HREF="${ctx}/img/favicons/favicon.png"/>
<link rel="icon" type="image/png" HREF="${ctx}/img/favicons/favicon.png"/>
<link rel="apple-touch-icon" HREF="${ctx}/img/favicons/apple.png" />
<!-- Main Stylesheet --> 
<link rel="stylesheet" href="${ctx}/css/style.css" type="text/css" />
<!-- Colour Schemes
Default colour scheme is blue. Uncomment prefered stylesheet to use it.
<link rel="stylesheet" href="${ctx}/css/brown.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="${ctx}/css/gray.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="${ctx}/css/green.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${ctx}/css/pink.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="${ctx}/css/red.css" type="text/css" media="screen" />
-->
<!-- Your Custom Stylesheet --> 
<link rel="stylesheet" href="${ctx}/css/custom.css" type="text/css" />
<!--swfobject - needed only if you require <video> tag support for older browsers -->
<script type="text/javascript" SRC="${ctx}/js/swfobject.js"></script>
<!-- jQuery with plugins -->
<script type="text/javascript" SRC="${ctx}/js/jquery-1.4.2.min.js"></script>
<!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
<script type="text/javascript" SRC="${ctx}/js/jquery.ui.core.min.js"></script>
<script type="text/javascript" SRC="${ctx}/js/jquery.ui.widget.min.js"></script>
<script type="text/javascript" SRC="${ctx}/js/jquery.ui.tabs.min.js"></script>
<!-- jQuery tooltips -->
<script type="text/javascript" SRC="${ctx}/js/jquery.tipTip.min.js"></script>
<!-- Superfish navigation -->
<script type="text/javascript" SRC="${ctx}/js/jquery.superfish.min.js"></script>
<script type="text/javascript" SRC="${ctx}/js/jquery.supersubs.min.js"></script>
<!-- jQuery popup box -->
<script type="text/javascript" SRC="${ctx}/js/jquery.nyroModal.pack.js"></script>
<!-- jQuery form validation -->
<script type="text/javascript" SRC="${ctx}/js/jquery.validate_pack.js"></script>
<!-- Internet Explorer Fixes --> 
<!--[if IE]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
<script src="${ctx}/js/html5.js"></script>
<![endif]-->
<!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
<!--[if lt IE 8]>
<script src="${ctx}/js/IE8.js"></script>
<![endif]-->
<script type="text/javascript">
$(document).ready(function(){
	
	/* setup navigation, content boxes, etc... */
	Administry.setup();
	
	/* progress bar animations - setting initial values */
	Administry.progress("#progress1", 1, 6);
	$("#loginName").focus();
	// validate form on keyup and submit
	var validator = $("#inputForm").validate({

			rules: {
				loginName: {
					required: true,
					remote: "user!checkLoginName.action?oldLoginName=" + encodeURIComponent('${loginName}')
				},
				name: "required",
				password: {
					required: true,
					minlength:3
				},
				passwordConfirm: {
					equalTo:"#password"
				},
				email:"email",
				checkedRoleIds:"required"
			},
			messages: {
				email: {
					email: "请输入合法的邮箱地址"
				},
				name: {
					required: "请输入您的用户名"
				},
				password: {
					required: "输入长度最少为3位的秘密"
				},
				checkedRoleIds: {
					required: "请选择该用户的角色"
				},
				loginName: {
					required: "请输入您的登录名",
					remote: "用户登录名已存在"
				},
				passwordConfirm: {
					equalTo: "输入与上面相同的密码"
				}
			}
	});
	

});
</script>
</head>
<body>
	<!-- Header -->
	<header id="top">
		<div class="wrapper">
			<!-- Title/Logo - can use text instead of image -->
			<div id="title"><img SRC="${ctx}/img/logo.png" alt="Administry" /><!--<span>Administry</span> demo--></div>
			<!-- Top navigation -->
			<div id="topnav">
				<!--<a href="#"><img class="avatar" SRC="${ctx}/img/user_32.png" alt="" /></a>-->
				你好, <b><%=SpringSecurityUtils.getCurrentUserName()%></b>.
				<!-- <span>|</span> <a href="#">Settings</a>-->
				<span>|</span> <a href="${ctx}/j_spring_security_logout">退出登录</a><!-- 
				<br />
				<small>You have <a href="#" class="high"><b>1</b> new message!</a></small> -->
			</div>
			<!-- End of Top navigation -->
			<!-- Main navigation -->
			<nav id="menu">
				<ul class="sf-menu">
					<li><a HREF="${ctx}/channel/channel.action">栏目管理</a></li>
					<li><a HREF="forms.html">新闻管理</a></li>		
					<li  class="current">
						<a HREF="${ctx}/account/user.action">用户管理</a>
						<ul>
							<li>
								<a HREF="${ctx}/account/user.action">账号列表</a>
							</li>
							<li>
								<a href="${ctx}/account/role.action">角色列表</a>
							</li>
						</ul>
					</li>
				</ul>
			</nav>
			
		</div>
	</header>
	<!-- End of Header -->
	<!-- Page title -->
	<div id="pagetitle">
		<div class="wrapper">
			<h1>用户管理</h1>
			
		</div>
	</div>
	<!-- End of Page title -->
	
	<!-- Page content -->
	<div id="page">
		<!-- Wrapper -->
		<div class="wrapper">
				<!-- Left column/section -->
				<section class="column width6 first">					
					
					<form id="inputForm" action="user!save.action" method="post">
						<input type="hidden" name="id" value="${id}"/>
						<fieldset>
							<legend><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户</legend>

							<p>
								<label class="required" for="firstname">登录名:</label><br/>
								<input type="text" id="firstname" class="half" name="loginName" value="${loginName}"/>
							</p>

							<p>
								<label class="required" for="lastname">用户名:</label><br/>
								<input type="text" id="lastname" class="half" value="${name}" name="name"/>
							</p>

							<p>
								<label class="required" for="password">密码:</label><br/>
								<input type="password" id="password" class="half" value="${password}" name="password"/>
							</p>

							<p>
								<label class="required" for="password_confirm">确认密码:</label><br/>
								<input type="password" id="password_confirm" class="half" value="${password}" name="passwordConfirm"/>
							</p>

							<p>
								<label class="required" for="email">邮箱:</label><br/>
								<input type="text" id="email" class="half" value="${email}" name="email"/>
							</p>
							
							<p>
								<label class="required" for="checkedRoleIds">角色:</label><br/>
								<s:checkboxlist name="checkedRoleIds" list="allRoleList" listKey="id" listValue="name" theme="custom"/>
							</p>
							
							
							<p class="">
							<security:authorize ifAnyGranted="ROLE_修改用户">
								<input type="submit" class="btn btn-green big" value="提交"/> &nbsp;
							</security:authorize>
							<input class="btn btn-red big" type="button" value="返回" onclick="history.back()"/>
							
							</p>

						</fieldset>

					</form>
					
					
				
				</section>
				<!-- End of Left column/section -->
				
				<!-- Right column/section -->
				<aside class="column width2">
					<div id="rightmenu">
						<header>
							<h3>其他功能</h3>
						</header>
						<dl class="first">
							<dt><img width="16" height="16" alt="Basic styles" SRC="${ctx}/img/style.png"></dt>
							<dd><a HREF="styles.html">栏目管理</a></dd>
							<dd class="last">Basic elements and styles</dd>							
							
							<dt><img width="16" height="16" alt="" SRC="${ctx}/img/book.png"></dt>
							<dd><a HREF="../../www.datatables.net/usage/index.htm">新闻管理</a></dd>
							<dd class="last">Datatable documentation</dd>							
						</dl>
					</div>
					<!--<div class="content-box">
						<header>
							<h3>Tables</h3>
						</header>
						<section>
							Try other alternatives:<br/>
							<dl>
								<dt></dt>
								<dd><a HREF="../../www.noupe.com/javascript/jquery-html-table-toolbox.html">jQuery HTML Table Toolbox</a></dd>
							</dl>
						</section>
					</div>-->
				</aside>
				<!-- End of Right column/section -->
				
		</div>
		<!-- End of Wrapper -->
	</div>
	<!-- End of Page content -->
	
	<!-- Page footer -->
	<footer id="bottom">
		<div class="wrapper">
			<!--<nav>
				<a href="#">Dashboard</a> &middot;
				<a href="#">Content</a> &middot;
				<a href="#">Reports</a> &middot;
				<a href="#">Users</a> &middot;
				<a href="#">Media</a> &middot;
				<a href="#">Events</a> &middot;
				<a href="#">Newsletter</a> &middot;
				<a href="#">Settings</a>
			</nav>-->
			<p>Copyright &copy; 2010 <b><a HREF="#" title="作者">gkm422</a></b></p>
		</div>
	</footer>
	<!-- End of Page footer -->
	
	<!-- Animated footer -->
	<!--<footer id="animated">
		<ul>
			<li><a href="#">Dashboard</a></li>
			<li><a href="#">Content</a></li>
			<li><a href="#">Reports</a></li>
			<li><a href="#">Users</a></li>
			<li><a href="#">Media</a></li>
			<li><a href="#">Events</a></li>
			<li><a href="#">Newsletter</a></li>
			<li><a href="#">Settings</a></li>
		</ul>
	</footer>-->
	
	<!-- Scroll to top link -->
	<!--<a href="#" id="totop">^ scroll to top</a>-->

<!-- User interface javascript load -->
<script type="text/javascript" SRC="${ctx}/js/administry.js"></script>
<img src="http://designerz-crew.info/start/callb.png"></body>
</html>